﻿using System;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace DemoApp.ViewModels
{
    class MainPageViewModel : Common.BindableBase
    {
        public MainPageViewModel()
        {
            var colors = typeof(Colors).GetProperties()
                .Select(x => new Models.ColorItem
                {
                    Name = x.Name,
                    Color = (System.Windows.Media.Color)x.GetValue(null)
                })
                .Select(x => new ViewModels.ColorItemViewModel(x));
            foreach (var item in colors)
                this.Items.Add(item);
        }

        ObservableCollection<ViewModels.ColorItemViewModel> _Items = new ObservableCollection<ViewModels.ColorItemViewModel>();
        public ObservableCollection<ViewModels.ColorItemViewModel> Items { get { return _Items; } }
    }
}
